package demo1;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: ASUS
 * Date: 2023-10-23
 * Time: 17:59
 */

public class Test4 {
  public int year;
  public int month;
  public int day;


  public Test4(){
      this.year = 2002;
      this.month = 9;
      this.day = 06;
      System.out.println("没有参数的构造方法！");

  }
  public Test4(int year,int month, int day){
      this.year = year;
      this.month = month;
      this.day = day;
      System.out.println("有三个参数的构造方法！");
  }

  public void serDate(int year, int month, int day) {
      this.year = year;
      this.month = month;

      this.day = day;
  }

  public void printDate() {
      System.out.println("年："+ this.year +"  月："+ this.month+"  日："+this.day);
  }

    public static void main(String[] args) {
        Test4 test1 = new Test4(2005,2,6);
        Test4 test2 = new Test4(2002,9,6);
        Test4 test3 = new Test4();

        test1.printDate();
        test2.printDate();
        test3.printDate();
    }
}
